package abg.manage.controller.jy;

import abg.core.common.security.Auth;
import abg.core.domain.db.AaFile;
import abg.core.domain.db.AaTask;
import abg.core.domain.db.AaXqCj;
import abg.core.domain.search.JwTaskPsh;
import abg.core.domain.search.TCourseFilePsh;
import abg.core.domain.search.TCoursePsh;
import abg.core.domain.search.TTaskPsh;
import abg.core.domain.sys.SRS;
import abg.core.service.jldz.JldzService;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 教师
 */
@Auth(role = {"40"})
@RestController
@RequestMapping("/manage/jldz/js")
public class JsC {
    @Resource
    private JldzService jldzService;

    //课程
    @PostMapping("/course")
    public SRS<Page<AaXqCj>> teacherCourse(TCoursePsh pageSearch) {
        String jsNumber = jldzService.getJsNumber();

        pageSearch.setCjsNumber(jsNumber);

        Page page = jldzService.teacherCourse(pageSearch);

        return SRS.bySuccess(page);
    }

    //课程任务文件
    @PostMapping("/courseFile")
    public SRS<Page<AaFile>> teacherCourseFile(TCourseFilePsh pageSearch) {
        pageSearch.setJsNumber(jldzService.getJsNumber());

        Page page = jldzService.teacherCourseFile(pageSearch);
        return SRS.bySuccess(page);
    }

    //教务处任务
    @PostMapping("/task")
    public SRS<Page<AaTask>> teacherTask(TTaskPsh pageSearch) {
        Page page = jldzService.teacherTask(pageSearch);
        return SRS.bySuccess(page);
    }


    /**
     * 教务处任务分页查询
     */
    @PostMapping(value = "/pageTask")
    public SRS<Page<AaTask>> pageTask(JwTaskPsh pageSearch) {
        pageSearch.setIsOpen("0");

        Page<AaTask> page = jldzService.jwPageTask(pageSearch);

        return SRS.bySuccess(page);
    }


}
